{% extends "forum_base.html" %}

{% block title %}Forums{% endblock %}

{% block forumcontent %}
<table id='djangoForumList'>
<tr>
<th>Forum</th>
<th>Last Post</th>
</tr>

{% for forum in object_list %}
{% if not forum.is_private %}
  <tr>
 <td class='djangoForumListDetails'>
 	<a class="forumName" href='{{ forum.get_absolute_url() }}'>{{ forum.title|e }}</a>
 	<span class='djangoForumStats'>{{ forum.threads }} threads, {{ forum.posts }} posts</span>
 	<p class="forumDescription">{{ forum.description|e }}</p>
 </td>
 {% set latest_post = forum.forum_latest_post %}
 <td class='djangoForumListLastPost'>{% if latest_post %}{{ latest_post.time|timesince }} ago by {% set U = latest_post.author %}{% include "webview/t/user.html" %} (<a href='{{ latest_post.get_absolute_url() }}'>view</a>){% else %}No posts{% endif %}</td>
 
 </tr>
{% else %}
 {% if user.is_staff %}
  <tr>
  <td class='djangoForumListDetails'>
 	 <a class="forumName" href='{{ forum.get_absolute_url() }}'>{{ forum.title|e }}</a>
 	 <span class='djangoForumStats'>{{ forum.threads }} threads, {{ forum.posts }} posts</span>
 	 <p class="forumDescription">{{ forum.description|e }}</p>
  </td>
  {% set latest_post = forum.forum_latest_post %}
  <td class='djangoForumListLastPost'>{% if latest_post %}{{ latest_post.time|timesince }} ago by {% set U = latest_post.author %}{% include "webview/t/user.html" %} (<a href='{{ latest_post.get_absolute_url() }}'>view</a>){% else %}No posts{% endif %}</td>
  
  </tr>
 {% endif %}
{% endif %}
{% endfor %}
</table>
{% if user.is_authenticated() %}<p><a href="{{ url("forum_subscriptions") }}">Manage Your Subscriptions</a></p>{% endif %}
{% endblock %}


